﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Jaqen.Lifenear.Entity;
using System.Data.Entity;
using System.Configuration;
using System.Reflection;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            string typeName=ConfigurationManager.AppSettings["DatabaseInitializerForType LifenearContext"];
            object obj = Assembly.GetExecutingAssembly().CreateInstance(typeName, false);
            Database.SetInitializer(obj as DropCreateDatabaseAlways<LifenearContext>);
            //Database.SetInitializer(new DropCreateDatabaseAlways<LifenearContext>());
            //Database.SetInitializer<LifenearContext>(new DropCreateUserDatabaseWithSeedValueAlways());

            //User user = new User();
            //user.UserName = "hjqcan@163.com";
            //user.UserPwd = "P@ssw0rd";

            var context = new LifenearContext();
            //context.Users.Add(user);
            //context.SaveChanges();

            var query = from c in context.Users
                        where c.UserId == 1
                        select c;
            if (query.Count() > 0)
            {
                User a = query.First();
            }
        }
    }
}
